package com.java.base.javabase.thread.start;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

import java.util.Random;

/**
 *@ClassName ThreadStart
 *@Description TODO 继承 Thread类,实现线程启动
 *@Author FangShanShan
 *@Date 2020/8/9 20:55
 *@Version 1.0
 */
@Slf4j
public class ThreadStart extends Thread{

    public void run() {
        int second = (new Random().nextInt(10) + 1) * 1000;
        log.info("<<< 线程:[{}] 启动, 执行时间:[{}]", Thread.currentThread().getName(), second);
        try {
            Thread.sleep(second);
            log.info("<<< 线程:[{}] 执行 --  结束", Thread.currentThread().getName(), second);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
